﻿@model IEnumerable<Questionnaire.Models.Question>

@{
    ViewData["HeadTitle"] = "问卷 - " + ViewBag.Title;
}

<h2>请回答下列问题</h2>
<hr />

@using (Html.BeginForm("Submitted", "Home", FormMethod.Post, new { id="questionForm"}))
{
    @Html.AntiForgeryToken()
    <div>
        @for (int i = 0; i < Model.Count(); i++)
        {
            <div>
                <lable class="label-info">@(i + 1)、@Html.DisplayFor(modelItem => Model.ElementAt(i).Topic)</lable>
                <div>
                    @foreach (var selection in ((List<Selection>)ViewData["Selections"]).Where(s => s.QuestionId == Model.ElementAt(i).Id))
                    {
                        @if (Model.ElementAt(i).SelectionType == SelectionType.SingleSelection)
                        {
                            <label class="radio-inline">
                                <input type="radio" name="question_@Model.ElementAt(i).Id" value="@selection.Id" required="required" />@selection.SymbolCode、@selection.Content
                            </label>
                            <br />
                        }
                        else
                        {
                            <label class="checkbox-inline">
                                <input type="checkbox"  name="question_@Model.ElementAt(i).Id" value="@selection.Id" />@selection.SymbolCode、@selection.Content
                            </label>
                            <br />
                        }
                    }
                </div>
            </div>
            <hr />
        }
        <div class="text-center">
            <button type="submit" class="btn btn-primary">提交</button>
        </div>
    </div>
}
<script src="~/js/question.js"></script>



